package com.object;

//研究toString 和 equals

public class Objects {
    public static void main(String[] args) {
       Student s1 = new Student();
       s1.setName("张三");
       s1.setAge("20");

       Student s2 = new Student("张三","20");

        System.out.println(s1 == s2);
        System.out.println(s1.toString() == s2.toString());

        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s1.toString());
        System.out.println(s2.toString());

        System.out.println(s1.equals(s2));

        System.out.println("2" == "2");
//        建议对象重写 toString方法

//        public boolean equals(Object obj) {
//            return (this == obj);
//        }

    }
}
